import request from '@/utils/request'

export function getUsers({userId, ...data}) {
    return request({
        url: `/user/queryUserByUserId/${userId}`,
        method: 'get',
        params: data
    })
}

export function updateUser(data){
    return request({
        url: "/user/update",
        method: 'post',
        data
    })
}

export function changePassword(data){
    return request({
        url: "/user/updatePassword",
        method: 'post',
        data
    })
}

export function updateEmail(data){
    return request({
        url: "/user/updateMail",
        method: 'post',
        data
    })
}

export function deleteUser(data) {
    return request({
        url: "/user/delete",
        method: 'post',
        data
    })
}

export function createUser(data) {
    return request({
        url: "/user/create",
        method: 'post',
        data
    })
}

export function getUser({id}) {
    return request({
        url: `/user/queryUserInfoByUserId/${id}`,
        method: 'get'
    })
}

export function getLocale() {
    return request({
        url: '/user/locale',
        method: 'get'
    })
}

export function getUserList(data) {
    return request({
        url: '/user/list',
        method: 'get',
        params: data
    })
}

export function getDepartments(){
    return request({
        url: '/department/list',
        method: 'get'
    })
}

export function resetUserPassword({id}) {
    return request({
        url: `/user/resetPassword/${id}`,
        method: 'post'
    })
}